package cn.lovemmd.model.mapper;

import cn.lovemmd.model.pojo.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserMapper extends BaseMapper<SysUser> {
    //根据用户名和密码查询用户
    @Select("select * from model_sys_user where u_name=#{name} and u_password=#{password}")
    SysUser selectByNameAndPassword(String name, String password);
    
    //根据用户名查询用户（用于验证用户是否存在）
    @Select("select * from model_sys_user where u_name=#{name}")
    SysUser selectByName(String name);
    
    @Insert("insert into model_sys_user(u_name,u_password,u_code,u_status,u_qq) values(#{name},#{password},#{code},0,#{qq})")
    Integer addUser(String name, String password, String code, String qq);
    @Select("select count(*) from model_sys_user where u_name = #{name}")
    Integer findUser(String name);
    @Select("select u_status from model_sys_user where u_name = #{name}")
    Integer getUserStatus(String name);
}
